package  {
	import command.CmdLightOff;
	import command.CmdLightOn;
	import flash.display.Sprite;
	import invoker.RemoteCtrl;
	import receiver.Light;
	/**
	 * ...
	 * @author wibrst@qq.com
	 */
	public class DoCtrl extends Sprite{
		
		public function DoCtrl() {
			
			///  the receiver
			var light:Light = new Light( "Living room" );	
			
			/// commands of various control
			var cmdLightOn:CmdLightOn = new CmdLightOn( light );
			var cmdLightOff:CmdLightOff = new CmdLightOff( light );
			
			/// the invoker
			var ctrl:RemoteCtrl = new RemoteCtrl;
			ctrl.setCmd( cmdLightOn, cmdLightOff );
			
			trace( ctrl );
			ctrl.btnPressed( RemoteCtrl.ACT_TYPE_ON );
			ctrl.btnPressed( RemoteCtrl.ACT_TYPE_OFF );
			trace( ctrl );
			ctrl.undoPressed();
			ctrl.btnPressed( RemoteCtrl.ACT_TYPE_OFF );
			ctrl.btnPressed( RemoteCtrl.ACT_TYPE_ON );
			trace( ctrl );
		}
		
		
		
	}

}